rm(list=ls())
# read in frame
df <- read.csv("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V7/2.Balance Checks/SoepRemote Output/Tables/Combined_Table_withoutCOBFE.csv")
# pre-processing
df <- data.frame(df)
### add sig at .05
df$sig_05 <- ifelse(df$pv<0.05,1,0)
df$sig_05 <- as.factor(df$sig_05)
## plot
library(ggplot2)
cbPalette <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#000000")
#### Subset balance plot just to demographic variables
df_dem <- subset(df,df$Hyp=="Demographic")
ggplot(data = df_dem, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~Outcome) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
png("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V7/2.Balance Checks/SoepRemote Output/Figures/BalancePlot_DemVars_noCoBFE.png",
width=10,height=6,units='in',res=300)
ggplot(data = df_dem, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~Outcome) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
dev.off()
rm(list=ls())
# read in frame
df <- read.csv("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V7/2.Balance Checks/SoepRemote Output/Tables/Combined_Table_withoutCOBFE.csv")
# pre-processing
df <- data.frame(df)
### add sig at .05
df$sig_05 <- ifelse(df$pv<0.05,1,0)
df$sig_05 <- as.factor(df$sig_05)
## plot
library(ggplot2)
cbPalette <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#000000")
#### Subset balance plot just to demographic variables
df_dem <- subset(df,df$Hyp=="Demographic")
ggplot(data = df_dem, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~Outcome) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
png("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V7/2.Balance Checks/SoepRemote Output/Figures/BalancePlot_DemVars_noCoBFE.png",
width=10,height=6,units='in',res=300)
ggplot(data = df_dem, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~Outcome) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
dev.off()
#### Subset balance plot just to demographic variables
df_other <- subset(df,df$Hyp!="Demographic")
ggplot(data = df_other, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~Outcome) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
####
#### Eroll Kuhn & Rahsaan Maxwell
#### Generating P-value plots (Balance checks)
rm(list=ls())
# read in frame
df <- read.csv("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V7/2.Balance Checks/SoepRemote Output/Tables/Combined_Table.csv")
# pre-processing
df <- data.frame(df)
### add sig at .05
df$sig_05 <- ifelse(df$pv<0.05,1,0)
df$sig_05 <- as.factor(df$sig_05)
## plot
library(ggplot2)
cbPalette <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#000000")
#### Subset balance plot just to demographic variables
df_dem <- subset(df,df$Hyp=="Demographic")
png("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V7/2.Balance Checks/SoepRemote Output/Figures/BalancePlot_DemVars.png",
width=10,height=6,units='in',res=300)
ggplot(data = df_dem, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~Outcome) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
dev.off()
#### Subset balance plot just to demographic variables
df_other <- subset(df,df$Hyp!="Demographic")
png("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V7/2.Balance Checks/SoepRemote Output/Figures/BalancePlot_ControlVars.png",
width=10,height=6,units='in',res=300)
ggplot(data = df_other, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~Outcome) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
dev.off()
### Demographic plot for non-COB Fe Model
rm(list=ls())
# read in frame
df <- read.csv("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V7/2.Balance Checks/SoepRemote Output/Tables/Combined_Table_withoutCOBFE.csv")
# pre-processing
df <- data.frame(df)
### add sig at .05
df$sig_05 <- ifelse(df$pv<0.05,1,0)
df$sig_05 <- as.factor(df$sig_05)
## plot
library(ggplot2)
cbPalette <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#000000")
#### Subset balance plot just to demographic variables
df_dem <- subset(df,df$Hyp=="Demographic")
png("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V7/2.Balance Checks/SoepRemote Output/Figures/BalancePlot_DemVars_noCoBFE.png",
width=10,height=6,units='in',res=300)
ggplot(data = df_dem, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~Outcome) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
dev.off()
#### Subset balance plot just to demographic variables
df_other <- subset(df,df$Hyp!="Demographic")
png("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V7/2.Balance Checks/SoepRemote Output/Figures/BalancePlot_ControlVars_noCoBFE.png",
width=10,height=6,units='in',res=300)
ggplot(data = df_other, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~Outcome) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
dev.off()
rm(list=ls())
# read in frame
df <- read.csv("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Clean Code V5/3.Outcomes Descriptive/Output/B.Tables/Combined_Tables.csv")
# pre-processing
df <- data.frame(df)
## outcome subsets and recode outcome
df_factor <- subset(df,df$Outcome=="Factor")
df_factor_weighted <- subset(df,(df$Outcome=="Factor" & df$Type=="Weighted"))
## index
df_index <- subset(df,df$Outcome=="Index")
df_index_weighted <- subset(df,(df$Outcome=="Index" & df$Type=="Weighted"))
rm(df)
## plot
library(ggplot2)
cbPalette <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#000000")
rm(list=ls())
# read in frame
df <- read.csv("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project//Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Code for Dataverse/3.Outcomes Descriptive/Output/B.Tables/Combined_Tables.csv")
rm(list=ls())
# read in frame
df <- read.csv("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Code for Dataverse/3.Outcomes Descriptive/Output/B.Tables/Combined_Tables.csv")
# pre-processing
df <- data.frame(df)
## outcome subsets and recode outcome
df_factor <- subset(df,df$Outcome=="Factor")
df_factor_weighted <- subset(df,(df$Outcome=="Factor" & df$Type=="Weighted"))
## index
df_index <- subset(df,df$Outcome=="Index")
df_index_weighted <- subset(df,(df$Outcome=="Index" & df$Type=="Weighted"))
rm(df)
## plot
library(ggplot2)
cbPalette <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#000000")
ggplot(data = df_index_weighted, aes(y = as.numeric(Prop),
x=as.numeric(Numeric))) +
geom_col() +
facet_wrap(~Type) +
xlab("Welcomeness Index") +
ylab("Proportion of Responses") +
theme_bw() +
theme(legend.direction = "horizontal",
legend.position = "bottom",
panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
ggplot(data = df_index, aes(y = as.numeric(Prop),
x=as.numeric(Numeric))) +
geom_col() +
facet_wrap(~Type) +
xlab("Welcomeness Index") +
ylab("Proportion of Responses") +
theme_bw() +
theme(legend.direction = "horizontal",
legend.position = "bottom",
panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
rm(list=ls())
# read in frame
df <- read.csv("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Code for Dataverse/2.Balance Checks/Output/B.Tables/Combined_Table.csv")
# pre-processing
df <- data.frame(df)
df$facet_lab <- ifelse(df$Outcome=="% Foreign-Born",1,
ifelse(df$Outcome=="% Non EU",2,
ifelse(df$Outcome=="% from Arabic-Speaking Countries",3,
ifelse(df$Outcome=="% Co-National",4,NA))))
df$facet_lab <- factor(df$facet_lab,
levels = c(1,2,3,4),
labels = c("% Foreign-Born",
"% Non-EU Foreign-Born",
"% from Arabic-Speaking Countries",
"% Co-National"))
### add sig at .05
df$sig_05 <- ifelse(df$pv<0.05,1,0)
df$sig_05 <- as.factor(df$sig_05)
## plot
library(ggplot2)
cbPalette <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#000000")
#### Subset balance plot just to demographic variables
df_dem <- subset(df,df$Hyp=="Demographic")
ggplot(data = df_dem, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~facet_lab) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
#### Subset balance plot just to demographic variables
df_other <- subset(df,df$Hyp!="Demographic")
ggplot(data = df_other, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~Outcome) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
rm(list=ls())
# read in frame
df <- read.csv("/Users/erollkuhn/Dropbox (Personal)/Refugee Context Project/Code for Dataverse/2.Balance Checks/Output/B.Tables/Combined_Table_withoutCOBFE.csv")
# pre-processing
df <- data.frame(df)
df$facet_lab <- ifelse(df$Outcome=="% Foreign-Born",1,
ifelse(df$Outcome=="% Non EU",2,
ifelse(df$Outcome=="% from Arabic-Speaking Countries",3,
ifelse(df$Outcome=="% Co-National",4,NA))))
df$facet_lab <- factor(df$facet_lab,
levels = c(1,2,3,4),
labels = c("% Foreign-Born",
"% Non-EU Foreign-Born",
"% from Arabic-Speaking Countries",
"% Co-National"))
### add sig at .05
df$sig_05 <- ifelse(df$pv<0.05,1,0)
df$sig_05 <- as.factor(df$sig_05)
## plot
library(ggplot2)
cbPalette <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#000000")
#### Subset balance plot just to demographic variables
df_dem <- subset(df,df$Hyp=="Demographic")
ggplot(data = df_dem, aes(x = pv, y = Variable,shape=sig_05)) +
facet_wrap(~facet_lab) +
geom_vline(xintercept = 0.05, lty = 2) +
geom_point(size = 2) +
ylab(NULL) +
xlab(expression(paste(italic("p"), "-value", sep=""))) +
theme_bw() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
panel.grid.major.y = element_line(size = .15, linetype = 2, color = "gray75"))
